package edu.ynu.se.xiecheng.achitectureclass.GreenHouse.GreenhouseEntity;

import edu.ynu.se.xiecheng.achitectureclass.common.entity.LogicEntity;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;

@Getter
@Setter
@Entity
@Table(name = "device")
public class Device extends LogicEntity {
    @Column(nullable = false, unique = true)
    private String deviceId; // 唯一设备序列号

    @Column(nullable = false)
    private String name; // 设备名称

    @Column(nullable = false)
    private String type; // 设备分类

    @Column
    private String unit; // 单位

    @Column
    private String monitorAddress; // 监控地址 (仅摄像头设备)

    @ManyToOne
    @JoinColumn(name = "greenhouse_id")
    private Greenhouse greenhouse; // 所属大棚
}

